/*
 * ICS314 Team Haines
 * @authors: David Teraoka, Kevon Adonis, Alexander Char, Samuel Roberts
 */
package avionics;

import avionics.AvionicsRadioSimulator;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import java.util.Random;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author David Teraoka
 */
public class AvionicsJUnitTest {
   
    public AvionicsJUnitTest()
    {
        
    }
    
    @Test
    public void testVOR()
    {
        VOR vor = new VOR(1);
        VOR vor2 = new VOR(100);
        VOR vor3 = new VOR(10000);
        assertEquals(0, vor.getAngle(), 0);
    }
    
    @Test
    public void testAvionicsRadioSimulation()
    {
        Random rng = new Random();
        AvionicsRadioSimulator test = new AvionicsRadioSimulator("test", "ABC");
        AvionicsRadioSimulator test1 = new AvionicsRadioSimulator("ABC");
        AvionicsRadioSimulator test2 = new AvionicsRadioSimulator("test", "asdf");
        assertEquals("test", test.getName());
        assertEquals("DefaultName", test1.getName());
        assertEquals("ZZZ", test2.getMorseName());
        assertEquals("ABC", test.getMorseName());
        assertNotNull(test.getSignalQuality(rng.nextInt(10)));        
        assertNotNull(test1.getSignalQuality(rng.nextInt(10)));
        assertNotNull(test2.getSignalQuality(rng.nextInt(10)));
    }
    
    @Test
    public void testGetSignalQuality()
    {
        AvionicsRadioSimulator test = new AvionicsRadioSimulator("test", "ABC");

        assertEquals("Good", test.getSignalQuality(0));
        assertEquals("Good", test.getSignalQuality(1));
        assertEquals("Good", test.getSignalQuality(2));
        assertEquals("Good", test.getSignalQuality(3));
        assertEquals("Good", test.getSignalQuality(4));
        assertEquals("Good", test.getSignalQuality(5));
        assertEquals("Good", test.getSignalQuality(6));
        assertEquals("Good", test.getSignalQuality(7));
        assertEquals("Good", test.getSignalQuality(8));
        assertEquals("Bad", test.getSignalQuality(9));
        assertEquals("Good", test.getSignalQuality(10));
        /**Need a way to test the RNG. One solution is to pass a random number to the getSignalQuality() method
         * instead of doing it in the method itself. 
         */
    }
    
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
    // @Test
    // public void hello() {}
}